<?php

/**
 * CredentialTasks form base class.
 *
 * @method CredentialTasks getObject() Returns the current form's model object
 *
 * @package    maximous
 * @subpackage form
 * @author     Mina.Gerges.Wadea
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCredentialTasksForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                       => new sfWidgetFormInputHidden(),
      'credential_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Credential'), 'add_empty' => true)),
      'site_component_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SiteComponent'), 'add_empty' => true)),
      'add_credential'           => new sfWidgetFormInputText(),
      'edit_credential'          => new sfWidgetFormInputText(),
      'delete_credential'        => new sfWidgetFormInputText(),
      'check_credential'         => new sfWidgetFormInputText(),
      'change_status_credential' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'credential_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Credential'), 'required' => false)),
      'site_component_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SiteComponent'), 'required' => false)),
      'add_credential'           => new sfValidatorInteger(array('required' => false)),
      'edit_credential'          => new sfValidatorInteger(array('required' => false)),
      'delete_credential'        => new sfValidatorInteger(array('required' => false)),
      'check_credential'         => new sfValidatorInteger(array('required' => false)),
      'change_status_credential' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('credential_tasks[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CredentialTasks';
  }

}
